package com.wyl.dao

import com.wyl.pojo.User
import org.apache.ibatis.annotations.Param
import org.apache.ibatis.annotations.Select
import org.apache.ibatis.annotations.Update

interface UserMapper {
    /**
     * 得到要登录的用户
     */
    @Select("select * from smbms_user where userCode = #{userCode}")
    fun getUserByUserCode(@Param("userCode") userCode: String): User?

    /**
     * 修改当前用户的密码
     */
    @Update("update smbms_user set userPassword=#{pwd} where id=#{id}")
    fun updatePwd(@Param("id") id: Int, @Param("pwd") password: String): Int

    /**
     * 查询用户总数
     */
    fun getUserCount(@Param("userName") userName: String?, @Param("userRole") userRole: Int?): Int

    /**
     * 通过条件查询-userList
     */
    fun getUserList(
        @Param("userName") userName: String?,
        @Param("userRole") userRole: Int?,
        @Param("from") currentPageNo: Int,
        @Param("pageSize") pageSize: Int
    ): List<User>

}